Must probably that Event Booking does not pass the email content through the Joomla content and system plugins before sending it.
So you won't be able to use any plugins inside the content.
I think I saw somewhere that sorcerer loaded include files twice by mistake in some Joommla 3.x version
and it seems the same error occurs also in Joomla 4.3.2.
I do like this in my article:
{source}
<?php
include JPATH_SITE . "/sourcerer/error.php"; // require_once seems to solve the problem
?>
{/source}
And got an error like this if I try to use/define an function in error.php
[Sat Jul 01 17:40:43.410879 2023] [proxy_fcgi:error] [pid 1892763:tid 140410013652736] PHP Fatal error:
Cannot redeclare categoryToGroup() (previously declared in /bitnami/joomla/sourcerer/error.php:46) in /bitnami/joomla/sourcerer/error.php on line 46’,
Like the comment in your code says, use require_one.
If the file contains code you do want to call multiple times,
Then place the classes in a different file and require that once inside error.php or in your php code inside the Sourcerer tags.